home *** CD-ROM | disk | FTP | other *** search
- Path: news.sunquest.com!kitk!kitk
- From: kitk@mudshark.sunquest.com (Kit Kauffmann)
- Newsgroups: comp.lang.c++
- Subject: Re: HELP: Calling functions from DLLs
- Date: Mon, 8 Jan 1996 15:04:05
- Organization: Sunquest
- Distribution: world
- Message-ID: <kitk.2047.000F11DE@mudshark.sunquest.com>
- References: <1996Jan8.194827.23308@zippy.dct.ac.uk>
- NNTP-Posting-Host: kkauffma.sunquest.com
- X-Newsreader: Trumpet for Windows [Version 1.0 Rev A]
-
- In article <1996Jan8.194827.23308@zippy.dct.ac.uk> ds11@st-and.ac.uk (Darren Steers) writes:
- >Subject: HELP: Calling functions from DLLs
- >From: ds11@st-and.ac.uk (Darren Steers)
- >Date: 8 Jan 96 19:48:27 GMT
-
- >Hi,
-
- >Can you help? I have been supplied with a DLL (not source code)
- >from a third party. It was compiled using MS Visual C++.
-
- >I am using Borland C++ 4.5 and am having problems calling the functions
- >from the third party DLL.
-
- >When I wrote a simple test DLL (Beep.cpp) the function prototype and
- >declaration were like this (From a book)
-
- > void _FAR _EXPFUNC MakeBeep (int iCount);
-
- >This worked great and I could use the function in my application
- >(CallBeep.cpp) to my hearts content.
-
- >HOWEVER, the 3rd party DLL had its functions declared in this style
-
- > void FAR PASCAL MakeBeep (int iCount);
-
- >When I try to use this function I get this error message
-
- > Linker Error: Undefined symbol MakeBeep(int) in module CALLBEEP.CPP
-
- >Can I get my application to recognise functions declared in the FAR PASCAL
- >format, or do I need to get the source code and change the function
- >prototypes and definitions to _FAR _EXPFUNC ????
-
- >Thanks for any help.
-
- >Darren Steers
-
- >University of St Andrews
- >Scotland
-
- >ds11@st-and.ac.uk
-
- try:
-
- extern "C"
- {
- void MakeBeep();
- }
-
- so the compiler knows the function is a "C" function (of course, if it was
- compiled as a C++ function, you are SOL, since VC and BC use different name
- mangling techniques)
-
-
- Kit Kauffmann - kitk@mudshark.sunquest.com
- AKA 73363,447 (Compu$erve)
-
- Finger me for my public key
-